<#assign className = fieldName?cap_first + "Enum"/>
public enum ${className} {
<#list defs as def>
<#--枚举类不需要给每个常量的注释加xx状态的前缀-->
	/** ${def.getName()} */
    ${MicroUtil.convertCamelCasedToUnderline(def.getEngCode())?upper_case}(${def.getValue()}, "${def.getName()}")<#if def_has_next>,<#else>;</#if>
</#list>

	private final ${primitiveType} value;
	private final String name;
	${className}(${primitiveType} value, String name) {
		this.value = value;
		this.name = name;
	}
	public ${primitiveType} getValue() {
		return this.value;
	}
	public String getName() {
		return this.name;
	}

	private static final ${className}[] values = values();
	public static ${className} getByValue(${primitiveType} value) {
		for (${className} item : values) {
			if (item.getValue() == value) {
				return item;
			}
		}
		throw new IllegalArgumentException("非法的${fieldName}值：" + value);
	}

	@Override
	public String toString() {
		return String.join("-", name(), String.valueOf(value), name);
	}
}